<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/base.jsp"%>
<%
	AreaDao dao = new AreaDao();
	String sql ="select * from t_area ";
	Object[]params={};
	List<Area> areaList = dao.queryOjects(sql, params);
	
		//加载用户原有信息
	String familycode=request.getParameter("id");
	Family f =new Family(familycode);
 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<link rel="stylesheet" type="text/css" href="css/admin.css">


</head>

<body>
	<div class="panel admin-panel">
		<div class="panel-head" id="add">
			<strong><span class="icon-pencil-square-o"></span>修改户基本信息</strong>
		</div>
		<div class="body-content">
			<form id="form-add" method="post" class="form-x"
				action="<%=path%>/system/FamilyServlet?m=edit">
				
				<div class="form-group">
					<div class="label">
						<label>所属行政区域：</label>
					</div>
					<div class="field">
						<select id="areacode" class="input w50" name="areacode">
						<%
							for(Area a : areaList){
						 %>
							<option value="<%=a.getAreacode()%>">
							 <%
						  
						  for(int i=0;i<a.getGrade();i++){
							 if(i==0){
								 out.print("|-"); 
							 }else{
								 out.print("-");
							 }
							  
						  } %>
							<%=a.getAreaname() %></option>
							
							<%} %>
							
						</select>
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>户主姓名：</label>
					</div>
					<div class="field">
						<input type="text" class="input" value="<%=f.getHousemaster() %>" name="housemaster"
							data-validate="required:请输入户主姓名" />
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>家庭编号：</label>
					</div>
					<div class="field">
						<input type="text" class="input" readonly="readonly" value="<%=f.getFamilycode() %>" name="familycode"
							data-validate="required:请输入家庭编号" />
						<div class="tips"></div>
					</div>
				</div>
				
				<div class="form-group">
					<div class="label">
						<label>家庭人口数：</label>
					</div>
					<div class="field">
						<input type="text" class="input" value="<%=f.getSumfamily() %>" name="sumfamily"
							data-validate="required:输入家庭人口数" />
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>农业人口数：</label>
					</div>
					<div class="field">
						<input type="text" class="input" value="<%=f.getSumfarmer() %>" name="sumfarmer"
							data-validate="required:输入农业人口数" />
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>家庭住址：</label>
					</div>
					<div class="field">
						<input type="text" class="input" name="address" value="<%=f.getAddress() %>"
							style="height:100px;"/>
					</div>
				</div>
				
				<div class="form-group">
					<div class="label">
						<label>修改日期：</label>
					</div>
					<div class="field">
						<input name="createtime" class="input" type="text" id="today" >
					</div>
				</div>

				<div class="form-group">
					<div class="label">
						<label></label>
					</div>
					<div class="field">
						<button id="add_btn" class="button bg-main icon-check-square-o"
							type="button">提交</button>
					</div>
				</div>
			</form>
		</div>
	</div>

</body>



<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="js/admin.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		//重新绑定表单提交
		$("#add_btn").bind("click", function() {
			$('form').submit();
		});
	});
	
	function today(){
    var today=new Date();
    var h=today.getFullYear();
    var m=today.getMonth()+1;
    var d=today.getDate();
    return h+"-"+m+"-"+d;
    }
    
    document.getElementById("today").value = today();
</script>
</html>
